<?php

use think\Facade\Route;
use think\Facade\Env;

Route::domain(Env::get('app.api_url'), function () {
    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH');
    header("Access-Control-Allow-Headers:peopleid,token,shopid, language, Origin, X-Requested-With, Content-Type, Accept");
    Route::miss(function () {
        $result = [
            'code' => 1,
            'msg'  => '接口不存在',
            'time' => time(),
            'data' => [],
        ];
        return json($result);
        exit();
    });
    Route::group('User', function () {
        Route::post('login', '/login'); //登录
        Route::post('login3', '/login3'); //登录
        Route::rule('address', '/address'); //地址管理
        Route::post('address_del', '/address_del'); //地址管理
        Route::rule('cart', '/cart'); //地址管理
        Route::post('cart_del', '/cart_del'); //地址管理
        Route::post('putorder', '/putorder'); //提交订单
        Route::get('orderlist', '/orderlist'); //订单列表
        Route::get('getcoupon', '/getcoupon'); //订单列表
        Route::get('getorders', '/getorders'); //订单列表
        Route::get('orderdetail', '/orderdetail'); //订单列表
        Route::post('compent', '/compent'); //提交订单
        Route::get('goodscompent', '/goodscompent'); //提交订单
        Route::get('info', '/info'); //提交订单
        Route::post('orderstatus', '/orderstatus'); //提交订单
        Route::get('qrcode', '/qrcode'); //提交订单
        Route::post('buyuser', '/buyuser'); //提交订单
        Route::rule('bussiness_res', '/bussiness_res');
        Route::post('receive', '/receive'); //提交订单
        Route::post('keyend', '/keyend'); //提交订单
        Route::rule('apply', '/apply'); //提交订单
        Route::get('integrallog', '/integrallog'); //提交订单
        Route::rule('rechange', '/rechange'); //提交订单
        Route::rule('putcommu', '/putcommu'); //提交订单
        Route::rule('getusercommulist', '/getusercommulist'); //提交订单
        Route::rule('comdetail', '/comdetail'); //提交订单
        Route::rule('comdetaildel', '/comdetaildel'); //提交订单
        Route::rule('pinglun', '/pinglun'); //提交订单
        Route::rule('rechange', '/rechange'); //提交订单
        Route::rule('fuka', '/fuka'); //提交订单
        Route::rule('updateinfo', '/updateinfo'); //提交订单
        Route::rule('loginmobile', '/loginmobile'); //提交订单
    })->prefix('User');

    Route::group('Shops', function () {
        Route::get('orderlist', '/orderlist'); //订单列表
        Route::get('orderdetail', '/orderdetail'); //订单列表
        Route::post('orderstatus', '/orderstatus'); //提交订单
        Route::post('goods_edit', '/goods_edit'); //提交订单
        Route::post('goods_static', '/goods_static'); //提交订单
        Route::get('getshop', '/getshop'); //订单列表
        Route::get('moneylog', '/moneylog'); //订单列表
        Route::rule('shop_edit', '/shop_edit'); //提交订单
        Route::rule('commulist', '/commulist'); //提交订单
        Route::rule('catelist', '/catelist'); //提交订单
    })->prefix('Shops');

    Route::group('Peoples', function () {
        Route::get('orderlist', '/orderlist'); //订单列表
        Route::post('orderstatus', '/orderstatus'); //提交订单
        Route::rule('people_edit', '/people_edit'); //订单列表
        Route::rule('commulist', '/commulist'); //提交订单
        Route::rule('catelist', '/catelist'); //提交订单
    })->prefix('Peoples');

    Route::group('Other', function () {
        Route::get('getstreet', '/getstreet'); //获取地址
        Route::get('addressjson', '/addressjson'); //获取本地地址库
        Route::get('getclass', '/getclass'); //平台分类
        Route::get('getgoodsclass', '/getgoodsclass'); //首页热推
        Route::get('getsonclass', '/getsonclass'); //平台子分类
        Route::get('goodsdetail', '/goodsdetail'); //商品详情
        Route::get('banner', '/banner'); //轮播图
        Route::get('goodslist', '/goodslist'); //商品列表
        Route::get('business', '/business'); //商品列表
        Route::rule('oss', '/oss'); //商品列表
        Route::get('user_level', '/user_level'); //商品列表
        Route::rule('callback', '/callback'); //商品列表
        Route::rule('callback2', '/callback2'); //商品列表
        Route::get('street', '/street'); //提交订单
        Route::get('others', '/others'); //提交订单
        Route::get('convenclass', '/convenclass'); //提交订单
        Route::get('conven', '/conven'); //提交订单
        Route::get('getOpenId', '/getOpenId'); //提交订单
        Route::rule('getOpenIds', '/getOpenIds'); //提交订单
        Route::get('getPtDatas', '/getPtDatas'); //提交订单
        Route::rule('fjgoodslist', '/fjgoodslist'); //提交订单
        Route::rule('fjsf', '/fjsf'); //附近师傅
        Route::rule('sfxm', '/sfxm'); //附近师傅
        Route::get('getagentcommu', '/getagentcommu'); //提交订单
        Route::get('getbusiness', '/getbusiness'); //提交订单
        Route::get('getrecomm', '/getrecomm'); //提交订单
        Route::get('businesscate', '/businesscate'); //提交订单
        Route::get('getxiaoqu', '/getxiaoqu'); //提交订单
        Route::get('getfjxiaoqu', '/getfjxiaoqu');
        Route::get('getgoodlist', '/getgoodlist');
    })->prefix('Other');

    Route::group('Goods', function () {
        Route::get('cate', '/cate'); //用户登录
        Route::get('categoods', '/categoods'); //用户登录
        Route::get('goodsdetail', '/goodsdetail'); //用户登录
        Route::post('add_order', '/add_order'); //用户登录
        Route::get('order', '/order'); //用户登录
        Route::get('orderdetail', '/orderdetail'); //用户登录
        Route::get('cacelconfirm', '/cacelconfirm'); //用户登录
    })->prefix('Goods');
})->bind('api')->prefix('api');
